<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 小夏 < 449134904@qq.com>
// +----------------------------------------------------------------------
namespace app\admin\validate;

use think\Validate;

class UserValidate extends Validate
{
    protected $rule = [
        'user_login'    => 'require|unique:user,user_login',
        'user_pass'     => 'require',
        'user_email'    => 'require|email|unique:user,user_email',
        'mobile'        => 'require',
        'basic_salary'  => 'require',
        'department_id' => 'require',
    ];
    protected $message = [
        'user_login.require'        => '用户不能为空',
        'user_login.unique'         => '用户名已存在',
        'user_pass.require'         => '密码不能为空',
        'user_email.require'        => '邮箱不能为空',
        'user_email.email'          => '邮箱不正确',
        'user_email.unique'         => '邮箱已经存在',
        'mobile.require'            => '手机号不能为空',
        'basic_salary.require'      => '底薪不能为空',
        'performance_salary.require'=> '绩效不能为空',
        'job_salary.require'        => '岗位薪资不能为空',
        'department_id.require'     => '请选择部门',
    ];

    protected $scene = [
        'add'  => ['user_login', 'user_pass', 'user_email','mobile','basic_salary','performance_salary','job_salary','department_id'],
        'edit' => ['user_login', 'user_email','mobile','basic_salary','performance_salary','job_salary','department_id'],
    ];
}